package org.pangu.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import org.pangu.api.ProductService;
import org.pangu.common.Result;
import org.pangu.dto.ProductDTO;
import org.pangu.mapper.ProductMapper;
import org.pangu.model.Product;
import org.pangu.vo.ProductVO;
import org.springframework.beans.factory.annotation.Autowired;

@Service /* (version="1.0") */
//@org.springframework.stereotype.Service
//@Service(tag="dev")
//@Service(async = true)
public class ProductServiceImpl implements ProductService {
	
	@Autowired
	private ProductMapper productMapper;

	@Override
	public Result<ProductVO> findProduct(ProductDTO dto) {

//		try {
//			Thread.sleep(10000L);
//		} catch (InterruptedException e) {
//			e.printStackTrace();
//		}
		System.out.println("1111111111");
		Integer productId = dto.getProductId();
		Product product = productMapper.selectByPrimaryKey(productId);
		ProductVO vo = new ProductVO();
		vo.setProductId(product.getId());
		vo.setProductName(product.getProductName());
		System.out.println("ProductDTO类型");
		return Result.success(vo);
	}

	@Override
	public Result<ProductVO> selectProduct(ProductDTO product) {
		return null;
	}

	@Override
	public Result<ProductVO> findProduct(String data) {
		// TODO Auto-generated method stub
		ProductVO productVO = new ProductVO();
		productVO.setProductId(222);
		System.out.println("String类型");
		return Result.success(productVO);
	}

}
